﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO.Ports;
using System.Threading;

namespace Comport
{
    public class Comport
    {
        private Object BufferInLock = new Object();
        private object BufferOutLock = new Object();
        private SerialPort mySerialport = new SerialPort();
        private string port = "COM1";
        public int dataOut()
        {
            lock (BufferOutLock)
            {
            }
            return 0;
        }
        public void dataIn()
        {
            lock (BufferInLock)
            {
            }
        }
        private void connect()
        {
            if (!mySerialport.IsOpen)
            {
                mySerialport.PortName = this.port;
                mySerialport.BaudRate = 9600;
                mySerialport.Open();
            }
        }
        private void disconnect()
        {
            if (mySerialport.IsOpen)
            {
                mySerialport.Close();
            }
        }
    }
}
